export const sumProperty = (arr: any[], f: (v: any) => number): number => {
    let sum = 0
    arr.forEach((item) => {
        sum += f(item)
    })
    return sum
}

export const arrInsert = <T>(arr: T[], item: T, index: number): T[] => {
    return arr
        .slice(0, index)
        .concat(
            [item].concat(
                arr.slice(index, arr.length)
            )
        );
}

export const clearLayout = () => {
    localStorage.setItem("layout", "");
};